﻿using System;
using Transformable_Engine_v2.Engine.Graphics;

namespace AngryManagementMayhem.Content.Textures.MainMenu
{
    public class MainMenuSpriteSheet : SpriteSheet
    {
        public enum SpriteListAlphabet
        {
            A = 0, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z,
            a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z,
            Ω, Period, Comma, ExclamationPoint, InterrogationPoint,
            Num1, Num2, Num3, Num4, Num5, Num6, Num7, Num8, Num9, Num0,
            Unknown
        }

        public enum SpriteList
        {
            RefreshIcon,
            ButtonLeft,
            ButtonRight,
            ButtonCenter,
            BuildingTop,
            BuildingMiddle,
            BuildingBottom,
            Next,
            Ok,
        }

        public enum GameMode
        {
            CaptureTheFlag,
        }

        public enum MapIcon
        {
            OfficeWars
        }

        public static void LoadContent()
        {
            GetInstance().SpriteSheetPath = "Content/Textures/MainMenu/MainMenu.png";

            GetInstance().AddSprite(SpriteList.RefreshIcon, new Sprite(0, 0, 2, 2));
            GetInstance().AddSprite(SpriteList.ButtonLeft, new Sprite(2, 0, 1, 2));
            GetInstance().AddSprite(SpriteList.ButtonRight, new Sprite(3, 0, 1, 2));
            GetInstance().AddSprite(SpriteList.ButtonCenter, new Sprite(17, 0, 1, 2));

            GetInstance().AddSprite(SpriteList.BuildingTop, new Sprite(0, 3, 6, 4));
            GetInstance().AddSprite(SpriteList.BuildingMiddle, new Sprite(0, 7, 6, 4));
            GetInstance().AddSprite(SpriteList.BuildingBottom, new Sprite(0, 11, 6, 4));

            GetInstance().AddSprite(SpriteList.Next, new Sprite(6, 3, 2, 2));
            GetInstance().AddSprite(SpriteList.Ok, new Sprite(8, 3, 2, 2));


            GetInstance().AddSprite(GameMode.CaptureTheFlag, new Sprite(6, 7, 2, 2));
            GetInstance().AddSprite(MapIcon.OfficeWars, new Sprite(6, 5, 2, 2));

            for (int i = 0; i <= (int) SpriteListAlphabet.Z; i++)
            {
                GetInstance().AddSprite((SpriteListAlphabet) i, new Sprite(4 + 0.5f * i, 0, 0.5f, 1));
                GetInstance().AddSprite((SpriteListAlphabet) (i + (int) SpriteListAlphabet.a), new Sprite(4 + 0.5f * i, 1, 0.5f, 1));
            }
            for (int i = 0; i <= (int)SpriteListAlphabet.Num0 - (int) SpriteListAlphabet.Num1; i++)
            {
                GetInstance().AddSprite((SpriteListAlphabet)(i + (int) SpriteListAlphabet.Num1), new Sprite(7 + 0.5f * i, 2, 0.5f, 1));
            }
            GetInstance().AddSprite(SpriteListAlphabet.Unknown, new Sprite(4, 2, 0.5f, 1));
            GetInstance().AddSprite(SpriteListAlphabet.InterrogationPoint, new Sprite(4.5f, 2, 0.5f, 1));
            GetInstance().AddSprite(SpriteListAlphabet.ExclamationPoint, new Sprite(5, 2, 0.5f, 1));
            GetInstance().AddSprite(SpriteListAlphabet.Period, new Sprite(5.5f, 2, 0.5f, 1));
            GetInstance().AddSprite(SpriteListAlphabet.Comma, new Sprite(6, 2, 0.5f, 1));
            GetInstance().AddSprite(SpriteListAlphabet.Ω, new Sprite(6.5f, 2, 0.5f, 1));

        }

        public static Sprite GetSprite(Enum sprite)
        {
            return GetInstance().Sprite(sprite);
        }

        public static Sprite GetSprite(SpriteListAlphabet sprite)
        {
            return GetInstance().Sprite(sprite);
        }

        public static Sprite GetSprite(string spriteName)
        {
            SpriteListAlphabet value;
            return Enum.TryParse(spriteName, false, out value) ? GetSprite(value) : null;
        }
    }
}